import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(home: MyApp()));
}

class MyApp extends StatelessWidget {
  MyApp({super.key, this.age = 18});
  int age;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text(
          'Hello World',
        ),
        backgroundColor: Colors.amber,
      ),
      body: Center(
        child: Text('我今年$age岁了'),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          age++;
          print(age);
        },
        child: const Icon(Icons.add),
      ),
    );
  }
}
